package com.zyh.number;

import java.math.BigDecimal;

public class NumberDemo7 {
    public static void main(String[] args) {
        BigDecimal big1 = new BigDecimal("123.123456789");
        //123.12
        BigDecimal divide1 = big1.divide(new BigDecimal("1"), 2, BigDecimal.ROUND_DOWN);
        System.out.println("divide1 = " + divide1);
        //123.13
        BigDecimal divide2 = big1.divide(new BigDecimal("1"), 2, BigDecimal.ROUND_UP);
        System.out.println("divide1 = " + divide2);
        //123.1235
        BigDecimal divide3 = big1.divide(new BigDecimal("1"), 4, BigDecimal.ROUND_HALF_UP);
        System.out.println("divide3 = " + divide3);
        //123.1234
        BigDecimal divide4 = big1.divide(new BigDecimal("1"), 4, BigDecimal.ROUND_HALF_DOWN);
        System.out.println("divide4 = " + divide4);
    }
}
